home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility1 / gs261src.zip / DOS_.H < prev    next >
C/C++ Source or Header  |  1993-05-13  |  3KB  |  78 lines

  1. /* Copyright (C) 1991, 1992 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* dos_.h */
  20. /* Generic DOS interface for Ghostscript */
  21.  
  22. /* This file is needed because the various DOS compilers */
  23. /* provide slightly different procedures for interfacing to DOS and */
  24. /* the I/O hardware, and because the Watcom compiler is 32-bit. */
  25. #include <dos.h>
  26. #if defined(__WATCOMC__) || defined(_MSC_VER)
  27.  
  28. /* ---------------- Microsoft C/C++, all models; */
  29. /* ---------------- Watcom compiler, 32-bit flat model. */
  30. /* ---------------- inp/outp prototypes are in conio.h, not dos.h. */
  31.  
  32. #  include <conio.h>
  33. #  define inport(px) inpw(px)
  34. #  define inportb(px) inp(px)
  35. #  define outport(px,w) outpw(px,w)
  36. #  define outportb(px,b) outp(px,b)
  37. #  define enable() _enable()
  38. #  define disable() _disable()
  39. #  define PTR_OFF(ptr) ((ushort)(uint)(ptr))
  40. /* Define the structure and procedures for file enumeration. */
  41. #define ff_name name
  42. #define dos_findfirst(n,b) _dos_findfirst(n, _A_NORMAL | _A_RDONLY, b)
  43. #define dos_findnext(b) _dos_findnext(b)
  44.  
  45. /* Define things that differ between Watcom and Microsoft. */
  46. #  ifdef __WATCOMC__
  47. #    define MK_PTR(seg,off) (((seg) << 4) + (off))
  48. #    define int86 int386
  49. #    define int86x int386x
  50. #    define rshort w
  51. #    define ff_struct_t struct find_t
  52. #  else
  53. #    define MK_PTR(seg,off) (((ulong)(seg) << 16) + (off))
  54. #    define cputs _cputs
  55. #    define fdopen _fdopen
  56. #    define O_BINARY _O_BINARY
  57. #    define REGS _REGS
  58. #    define rshort x
  59. #    define ff_struct_t struct _find_t
  60. #    define stdprn _stdprn
  61. #  endif
  62.  
  63. #else            /* not Watcom or Microsoft */
  64.  
  65. /* ---------------- Borland compiler, 16:16 pseudo-segmented model. */
  66. /* ---------------- ffblk is in dir.h, not dos.h. */
  67. #include <dir.h>
  68. #  define MK_PTR(seg,off) MK_FP(seg,off)
  69. #  define PTR_OFF(ptr) FP_OFF(ptr)
  70. /* Define the regs union tag for short registers. */
  71. #  define rshort x
  72. /* Define the structure and procedures for file enumeration. */
  73. #define ff_struct_t struct ffblk
  74. #define dos_findfirst(n,b) findfirst(n, b, 0)
  75. #define dos_findnext(b) findnext(b)
  76.  
  77. #endif
  78.